<?php
//测试控制器类
class IndexController extends AuthController{
    //动作方法
    public function index(){
        //显示视图
        $this->display();
    }

    public function welcome(){
    	$this->smsCount = $this->getSms();
    	$this->display();
    }

    private function getSms(){
    	$username = "qizun";
		$password = "367BRSEH";
		$url="http://114.215.202.188:8081/SmsAndMms/balance?";
		$curlPost = 'Sn='.$username.'&Pwd='.$password.'';

		$ch = curl_init();//初始化curl
		curl_setopt($ch,CURLOPT_URL,$url);//抓取指定网页
		curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //要求结果为字符串且输出到屏幕上
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);  //允许curl提交后,网页重定向  
		curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
		curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
		$data = curl_exec($ch);//运行curl
		curl_close($ch);

		return $data;
    }
}
